<div class="jumbotron">
	<div id="navbar-inner" class="navbar-inner header">
		<span class="span-leave"><?php echo strtoupper(PNC_Controller::EMP_CRUID); ?></span>
	</div>
</div>
<hr />

<!-- show row of employee -->
<?php
//if ($this->uri->segment(3) != 'view_detail') {
	?>
	<div class="row-fluid">
		<?php
		if ($employee > 0) {
			$page = $this->uri->segment(3);
			$page = $page ? $page : 0;
			// display message
			if ($this->session->userdata('add_employee')) {
				echo $this->session->userdata('add_employee');
				$this->session->unset_userdata('add_employee');
			} else if ($this->session->userdata('delete_checked')) {
				echo $this->session->userdata('delete_checked');
				$this->session->unset_userdata('delete_checked');
			} else if ($this->session->userdata('delete_error')) {
				echo $this->session->userdata('delete_error');
				$this->session->unset_userdata('delete_error');
			} else if ($this->session->userdata('delete_success')) {
				echo $this->session->userdata('delete_success');
				$this->session->unset_userdata('delete_success');
			} else if ($this->session->userdata('edit_success')) {
				echo $this->session->userdata('edit_success');
				$this->session->unset_userdata('edit_success');
			}
			echo form_open('employee/delete_employees', $page);
			?>
			<div class="cleaner"></div>
			<?php
			$this->load->view('incs/num_perpage');
			?>
			<table  class="display emp" id="search">
				<thead>
					<tr class="success">
						<th class="sorting_1">N&ordm;</th>
						<th class="td-check"><?php echo form_checkbox(array('name' => 'checker', 'id' => 'check_header')); ?></th>
						<th>ID</th>
						<th>Full Name</th>
						<th>Username</th>
						<th class="td-check">Gender</th>
						<th>Department</th>
						<!--<th class="sorting_1">Group</th>-->	
						<th>Position</th>
						<th class="td-check">Action</th>
					</tr>
				</thead>
				<tbody>
					<?php
					// column id
					$id = 1;
					if ($this->uri->segment(3)) {
						$id = $this->uri->segment(3) + 1;
					} else {
						$id = 1;
					}
					foreach ($employee as $data):
						?>
						<tr class="tbl">
							<td class="sorting_1"><?php echo $id++; ?></td>
							<td class="td-check"><?php echo form_checkbox(array('class' => 'check_value', 'id' => 'emp_check', 'name' => 'empCheck[]'), $data->staff_id); ?></td>
							<td><?php echo anchor('employee/view_detail/'. $data->staff_id, $data->emp_id, 'class="detail" row_id="' . $data->staff_id . '" title="View Detail"'); ?></td>
							<td class="show_dtl"><span class="txt-bold">
									<?php
									echo anchor('employee/view_detail/'. $data->staff_id, strtoupper($data->emp_lname) . ' ' . ucfirst($data->emp_fname), 'class="detail" row_id="' . $data->staff_id . '" title="View Detail"');
									?>
								</span></td>
							<td><?php
							echo anchor('employee/view_detail/'. $data->staff_id, $data->username, 'class="detail" row_id="' . $data->staff_id . '" title="View Detail"'); ?></td>
							<td class="td-check"><?php echo anchor('employee/view_detail/'. $data->staff_id, $data->emp_gender, 'class="detail" row_id="' . $data->staff_id . '" title="View Detail"'); ?></td>
							<td><?php echo anchor('employee/view_detail/'. $data->staff_id, $data->dept_name, 'class="detail" row_id="' . $data->staff_id . '" title="View Detail"'); ?></td>
							<!--<td class="sorting_1"><?php echo anchor('employee/view_detail/'. $data->staff_id, $data->grp_name, 'class="detail" row_id="' . $data->staff_id . '" title="View Detail"'); ?></td>-->
							<td><?php echo $data->pos_name; ?></td>
							<td class="td-check"><?php
						$del = img('bootstrap/images/del.png');
						$edit = img('bootstrap/images/edit.gif');
						echo anchor('employee/edit_employee/' . $data->staff_id, $edit, 'title="Edit"') . ' | ' . anchor('employee/delete/' . $page . '/' . $data->staff_id, $del, 'title="Delete" onclick="return confirm(\'Are you sure want to delete?\');"')
									?></td>
						</tr>
					<?php endforeach; ?>
				</tbody>
			</table>
			<table>
				<?php
				if ($pagination) {
					?>
					<tr>
						<td>
							<span class="pull-right control" >
								<?php
								echo form_submit('btn_del_emp', 'Delete', 'onclick="return confirm(\'Are you sure?\');" class="btn btn-info"') . nbs(2) . anchor('employee/add_employee', form_button('btn_add_emp', 'Add New', 'class="btn btn-info"'));
								?>
							</span></td>
						<td>
							<span class="pagination-link"><?php echo $pagination; ?></span>
						</td>
					</tr>
				<?php } else { ?>

					<tr>
						<td>
							<span class="pull-right control">
								<?php
								echo form_submit('btn_del_emp', 'Delete', 'onclick="return confirm(\'Are you sure?\');" class="btn btn-info"') . nbs(2) . anchor('employee/add_employee', form_button('btn_add_emp', 'Add New', 'class="btn btn-info"'));
								?>
							</span></td>
					</tr>
				<?php } ?>
			</table>
			<?php
			echo form_close();
		} else {
			?>
			<table>
				<tr>
					<td><?php echo "Data not found!!"; ?></td>
				</tr>
			</table>
		<?php } ?>
	</div>
<?php //} else if ($this->uri->segment(3) === 'view_detail') {
//		$this->load->view('employee/view_detail');
//} ?>